<!--[if !IE 7]>
    <style type="text/css">
            #wrap {display:table;height:100%}
    </style>
<![endif]-->
<?=$this->headMeta();?>
<?=$this->headTitle();?>
<!--
    <link rel="shortcut icon" href="images/favicon.gif" type="image/gif" />
-->
<?php
/*
 * css
 */
$this->headLink()->prependStylesheet($this->baseUrl().'/media/main.css');
?>
<?php
/*
 * js
 */
$this->headScript()->prependFile($this->baseUrl().'/media/js/jquery-1.5.2.min.js');
?>
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> -->

<script type="text/javascript">
function selNorme(nomeCategoria){
// Seleziono province di questa regione. 
  $.getJSON('http://localhost:10999/public/Index/search-norme-categorie', 
            { categoria: nomeCategoria},
                  function(dataNorme){
                    console.log(dataNorme);
                    $("select[id='id_norma_violata']").empty();
                    var options = '<option value="">-- seleziona --</option>';
                    var arrayNorme = dataNorme;

                   $.each(arrayNorme, function(key, value){
//                       alert(key + ': ' + value);
//                       console.log(value);
                       options += '<option value="' + value.id_lib_norma + '">' + value.norma_violata + '</option>';                       
                   });                   
                    $("select[id='id_norma_violata']").html(options);
                    $("input[id='importo']").empty();
                    
                  });
                      
}
function selNorma(idNorma){
// Seleziono province di questa regione. 
  $.getJSON('http://localhost:10999/public/Index/search-norma', 
            { id: idNorma},
                  function(dataNorma){
                    //alert(dataNorma.id_lib_norma);
                    //alert(dataNorma.norma_sazionamento);                    
                    console.log(dataNorma);
                    $("input[name='id_norma']").empty(); 
                    $("input[name='importo']").attr('id',dataNorma.id_lib_norma); 
                    $("input[name='id_norma']").val(dataNorma.norma_sazionamento);
                    
                    $('#id_lib_norma').attr('value',dataNorma.id_lib_norma);                     
                    
                    $("input[name='importo']").empty();  
                    $("input[name='importo']").val(dataNorma.importo_applicato);                    
                  });
                      
}
/*
request = $.getJSON('http://localhost:10999/public/Index/search',{
                        q:$q.val(),table:'lib_comune'
                    },function(data){           
                        showResults(data,$q.val(),'accertamento');
                        runningRequest=false;
                    });
                    */
</script>
<?=$this->headLink();?>    
<?=$this->headScript();?>